package com.java.system.common.rest;

import com.github.pagehelper.PageInfo;
/*import com.joyoung.cloud.security.common.msg.RestRes;
import com.joyoung.cloud.security.common.service.BaseService;
import com.joyoung.cloud.security.common.validatedGroup.Add;
import com.joyoung.cloud.security.common.validatedGroup.Modify;*/
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 基类控制层,只用于为名为soymilkadmin的前端项目提供公用接口
 *
 * @author yangyuwei
 * @create 2019-05-30
 */
@Slf4j
public class BaseOnController/*<Service extends BaseService, Entity>*/ {
   /* @Autowired
    protected Service service;
    *//**
     * @return java.lang.Object
     * @Description 分页获取列表
     * @Date 2019/5/30
     * @Param [query, page, size]
     **//*
    @GetMapping("")
    public Object page(Entity query, Integer page, Integer size) {
        PageInfo pageInfo = service.page(query, page, size);
        return RestRes.table(pageInfo);

    }


    *//**
     * @return java.lang.Object
     * @Description 添加一条记录
     * @Date 2019/5/30
     * @Param [query]
     **//*
    @PostMapping("")
    public Object add(@Validated({Add.class}) Entity entity) {
        service.insertSelective(entity);
        return 1;
    }

    *//**
     * @return java.lang.Object
     * @Description 编辑信息
     * @Date 2019/5/30
     * @Param [query]
     **//*
    @PutMapping("")
    public Object edit(@Validated({Modify.class}) Entity entity) {
        service.updateSelectiveById(entity);
        return 1;
    }

    *//**
     * @return java.lang.Object
     * @Description 删除信息
     * @Date 2019/5/30
     * @Param [id]
     **//*
    @DeleteMapping("/{id}")
    public Object del(@PathVariable String id) {
        service.deleteById(id);
        return 1;
    }
    *//**
     * @Description 查询单条记录
     * @author yangyuwei on 2019/8/20 19:58
     * @param  id  description
     * @return java.lang.Object
    **//*
    @GetMapping("/{id}")
    public Object get(@PathVariable String id) {
        return service.selectById(id);
    }*/
}
